package com.objetdirect.gwt.umldrawer.client;

import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;

public class EditProfile {

	private static HorizontalPanel horizontalPanel = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel2 = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel3 = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel33 = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel4 = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel5 = new HorizontalPanel();
	private static HorizontalPanel horizontalPanel6 = new HorizontalPanel();

	private static VerticalPanel verticalPanel = new VerticalPanel();
	
	private static Label title = new Label("Profile : ");
	private static Label eMail = new Label("E-mail : Bakhoum@Andrew.Sandra");
	private static Label name = new Label("Name : Andrew Sandra Bakhoum");
	
	private static Label firstName = new Label("First name : ");
	private static Label lastName = new Label("Last name : ");
	
	private static Label password = new Label("Password : ******");
	private static Label newPassword = new Label("New password : ");
	private static Label confirmPassword = new Label("Re-type password : ");
	
	private static TextBox firstNameTextBox = new TextBox();
	private static TextBox lastNameTextBox = new TextBox();
	
	private static PasswordTextBox newPasswordTextBox = new PasswordTextBox();
	private static PasswordTextBox confirmPasswordTextBox = new PasswordTextBox();
	
	private static Button editNameButton = new Button("Edit Name");
	
	private static Button changePassword = new Button("Change password");
	private static Button cancelChangePassword = new Button("Cancel Change password");
	private static Button saveChanges = new Button("Save Changes");
	
	public Panel getEditProfilePanel()
	{
		Panel editProfile = new Panel();
		editProfile.setSize(910, 500);
		editProfile.setBorder(false);
		
		horizontalPanel2.setVisible(true);

		title.setStyleName("pagesHeader");
		verticalPanel.add(title);
		
		
		eMail.setStyleName("labelsEditProfile");
		name.setStyleName("labelsEditProfile");
		password.setStyleName("labelsEditProfile");
		firstName.setStyleName("labelsEditProfile");
		lastName.setStyleName("labelsEditProfile");
		
		newPassword.setStyleName("labelsEditProfile");
		newPasswordTextBox.setStyleName("textBoxEditProfile");
		confirmPassword.setStyleName("labelsEditProfile");
		confirmPasswordTextBox.setStyleName("textBoxEditProfile");
		
		
		horizontalPanel.setStyleName("horizontalPanelEditProfile");
		horizontalPanel2.setStyleName("horizontalPanelEditProfile");
		horizontalPanel3.setStyleName("horizontalPanelEditProfile");
		horizontalPanel33.setStyleName("horizontalPanelEditProfile");
		horizontalPanel4.setStyleName("horizontalPanelEditProfile");
		horizontalPanel5.setStyleName("horizontalPanelEditProfile");
		horizontalPanel6.setStyleName("horizontalPanelEditProfile");
		
		
		horizontalPanel.add(eMail);
		verticalPanel.add(horizontalPanel);
		
		horizontalPanel2.add(name);
		horizontalPanel2.add(editNameButton);
		verticalPanel.add(horizontalPanel2);
		
		horizontalPanel3.add(firstName);
		horizontalPanel3.add(firstNameTextBox);
		firstNameTextBox.setText("Andrew");
		horizontalPanel3.setVisible(false);
		verticalPanel.add(horizontalPanel3);
		
		horizontalPanel33.add(lastName);
		horizontalPanel33.add(lastNameTextBox);
		lastNameTextBox.setText("Sandra Bakhoum");
		horizontalPanel33.setVisible(false);
		verticalPanel.add(horizontalPanel33);
		
		editNameButton.addListener(new ButtonListenerAdapter()
		{
			@Override
			public void onClick(Button button, EventObject e) {
				// TODO Auto-generated method stub
				horizontalPanel3.setVisible(true);
				horizontalPanel33.setVisible(true);
				horizontalPanel2.setVisible(false);
			}
		});
		
		
		
		horizontalPanel4.add(password);
		horizontalPanel4.add(changePassword);
		verticalPanel.add(horizontalPanel4);

		horizontalPanel5.add(newPassword);
		horizontalPanel5.add(newPasswordTextBox);
		horizontalPanel5.add(cancelChangePassword);
		verticalPanel.add(horizontalPanel5);
		
		horizontalPanel6.add(confirmPassword);
		horizontalPanel6.add(confirmPasswordTextBox);
		verticalPanel.add(horizontalPanel6);
		
		horizontalPanel5.setVisible(false);
		horizontalPanel6.setVisible(false);
		
		changePassword.addListener(new ButtonListenerAdapter()
		{
			@Override
			public void onClick(Button button, EventObject e) {
				// TODO Auto-generated method stub
				horizontalPanel5.setVisible(true);
				horizontalPanel6.setVisible(true);
				
			}
		});
		
		

		cancelChangePassword.addListener(new ButtonListenerAdapter()
		{
			@Override
			public void onClick(Button button, EventObject e) {
				// TODO Auto-generated method stub
				horizontalPanel5.setVisible(false);
				horizontalPanel6.setVisible(false);
			}
		});
		
		saveChanges.setStyleName("horizontalPanelEditProfileSaveChanges");
		verticalPanel.add(saveChanges);
		
		editProfile.add(verticalPanel);
		return editProfile;
	}
}
